package com.cskaoyan.controller.configController;

import com.cskaoyan.model.bean.ConfigManage;
import com.cskaoyan.model.vo.extend.BaseRespVo;
import com.cskaoyan.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：Chunk
 * @Description:
 * @Date Created in 10:25 2021/4/11
 */
@RestController
@RequestMapping("admin/config")
public class ConfigController {
    @Autowired
    ConfigService configService;

    @GetMapping("mall")
    public BaseRespVo queryMall(){
        ConfigManage configManage = configService.queryMall();
        return BaseRespVo.ok(configManage);
    }
    @PostMapping("mall")
    public BaseRespVo updateMall(@RequestBody ConfigManage configManage){
        configService.updateMall(configManage);
        return BaseRespVo.ok();
    }
    @GetMapping("express")
    public BaseRespVo queryExpress(){
        ConfigManage configManage = configService.queryExpress();
        return BaseRespVo.ok(configManage);
    }
    @PostMapping("express")
    public BaseRespVo updateExpress(@RequestBody ConfigManage configManage){
        configService.updateExpress(configManage);
        return BaseRespVo.ok();
    }
    @GetMapping("order")
    public BaseRespVo queryOrder(){
        ConfigManage configManage = configService.queryOrder();
        return BaseRespVo.ok(configManage);
    }
    @PostMapping("order")
    public BaseRespVo updateOrder(@RequestBody ConfigManage configManage){
        configService.updateOrder(configManage);
        return BaseRespVo.ok();
    }
    @GetMapping("wx")
    public BaseRespVo queryWx(){
        ConfigManage configManage = configService.queryWx();
        return BaseRespVo.ok(configManage);
    }
    @PostMapping("wx")
    public BaseRespVo updateWx(@RequestBody ConfigManage configManage){
        configService.updateWx(configManage);
        return BaseRespVo.ok();
    }
}
